package huizhi.exercise;

import cn.hutool.core.util.StrUtil;

import java.util.Random;

public class SplicingString2 {
    /**
     * 箱单号命名规则: 混箱 HX+ 随机3位数+周一A+箱单序号 0001=HX***A0001:(ABCDEFG代表着周一到周日)
     * x 整箱还是混箱
     * week 周几
     * num 打印多少数字
     * n 箱单序号是几位数
     * @param args
     */
    public static void main(String[] args) {
        String x = "ZX";
        int w = 6;
        long a =100;
        int n = 4;
        splicing(x,w,a,4);

    }

    /**
     *
     * @param x 整箱还是混箱
     * @param week 周几
     * @param num 打印多少数字
     * @param n 箱单序号是几位数
     */
    private static void splicing(String x,int week,long num,int n) {
        String value = "";
        value += x;
        Random random = new Random();
        value += "{}";
        for (int i = 0; i <num ; i++) {
            int i1 = random.nextInt(900) + 100;
            String a = i1+"";
            String s = String.format("%0"+n+"d",i);
            String as = a+s;
            String format = StrUtil.format(value, as);
            System.out.println(format);
        }

    }
}
